/*
 * Copyright (C) 2019 ByteDance Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bytedance.scene.animation.interaction.scenetransition;

import com.bytedance.scene.animation.interaction.scenetransition.utils.SceneViewCompatUtils;
import ohos.agp.components.Component;
import ohos.agp.components.DragEvent;
import ohos.agp.utils.Rect;
import ohos.utils.ObjectAttribute;

/**
 * Created by JiangQi on 10/19/18.
 */
public class PropertyUtilis {
    public static final ObjectAttribute<Component, Rect> CLIP_BOUNDS = new ObjectAttribute<Component, Rect>(Rect.class, "clipBounds") {
        @Override
        public Rect get(Component o) {
            return null;
        }

        @Override
        public void set(Component obj, Rect value) {
            super.set(obj, value);
        }
    };

//    public static final Property<Component, Rect> CLIP_BOUNDS =
//            new Property<Component, Rect>(Rect.class, "clipBounds") {
//
//                @Override
//                public Rect get(Component view) {
//                    return ViewCompat.getClipBounds(view);
//                }
//
//                @Override
//                public void set(Component view, Rect clipBounds) {
//                    ViewCompat.setClipBounds(view, clipBounds);
//                }
//
//            };

    //    public static final Property<Component, Float> TRANSITION_ALPHA =
//            new Property<Component, Float>(Float.class, "translationAlpha") {
//
//                @Override
//                public Float get(Component view) {
//                    return SceneViewCompatUtils.getTransitionAlpha(view);
//                }
//
//                @Override
//                public void set(Component view, Float alpha) {
//                    SceneViewCompatUtils.setTransitionAlpha(view, alpha);
//                }
//
//            };

    public static final ObjectAttribute<Component, Float> TRANSITION_ALPHA = new ObjectAttribute<Component, Float>(Float.class, "translationAlpha") {
        @Override
        public Float get(Component o) {
            return SceneViewCompatUtils.getTransitionAlpha(o);
        }

        @Override
        public void set(Component obj, Float value) {
            super.set(obj, value);
            SceneViewCompatUtils.setTransitionAlpha(obj, value);
        }
    };
}
